<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core" xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:t="https://code.google.com/p/rad-framework/taglib"
	xmlns:s="http://jboss.com/products/seam/taglib">
	
	<a4j:region>
	<rich:tabPanel 
		switchType="ajax" 
		selectedTab="rich"
		headerAlignment="right" >
		
		<ui:remove>
		<!--
		For JSFUnit testing remove the rich tab and override tag in
			myproject-qa\src\main\webapp\WEB-INF\jsf\tags\editor.xhtml
			
		http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4236496#4236496 
		-->
		</ui:remove>
		
		<rich:tab name="rich"
			label="#{messages['RichText']}">
		
			<rich:editor id="#{id}" value="#{value}"
				disabled="#{disabled}"
				required="#{required}"
				useSeamText="true"
				theme="advanced"
				plugins="table,paste,emotions,fullscreen"
				styleClass="#{styleClass}">
		
				<f:param name="theme_advanced_resizing" value="true"/>
				<f:param name="theme_advanced_resize_horizontal" value="false"/>
				<f:param name="width" value="100%"/>
		
				<f:param name="theme_advanced_toolbar_location" value="top"/>                               
				<f:param name="theme_advanced_toolbar_align" value="left"/>
				<f:param name="theme_advanced_statusbar_location" value="bottom"/>
				<f:param name="theme_advanced_path" value="false" />

				<f:param name="theme_advanced_buttons1" value="formatselect,bold,italic,underline,strikethrough,|,table,delete_col,delete_row,col_after,col_before,row_after,row_before,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,image,forecolor,hr,emotions,charmap,|,fullscreen" />
				<f:param name="theme_advanced_buttons2" value="" />
				<f:param name="theme_advanced_buttons3" value="" />
							
				<s:validateFormattedText/>

			</rich:editor>
				
		</rich:tab>
		<rich:tab name="markup"
			label="#{messages['Markup']}">
		
			<h:inputTextarea id="#{id}Src" value="#{value}"
				disabled="#{disabled}"
				required="#{required}" 
				rows="10"
				styleClass="rad-framework-form-input-field">

				<s:validateFormattedText/>

			</h:inputTextarea>
		
		</rich:tab>
		<rich:tab name="preview"
			label="#{messages['Preview']}">
		
			<s:formattedText value="#{value}" />
		
		</rich:tab>
	</rich:tabPanel>
	</a4j:region>
	
<ui:remove>
	http://wiki.moxiecode.com/index.php/TinyMCE:Control_reference

TODO 
- simple and advanced properties configuration
- custom link and image plugins
- custom seam table format
- custom seam entity link

	<!--	
	http://svn.atlassian.com/fisheye/browse/~raw,r=14296/public/contrib/confluence/atlassian-tinymce-plugin/trunk/src/main/resources/com/atlassian/confluence/extra/tinymceplugin/TinyMceEditor.vm

        mode : "exact",
        elements : theElements,
        //dialog_type : "modal",
        height: "$height",
        content_css : '$req.contextPath/styles/wysiwyg-action.css?spaceKey=$generalUtil.urlEncode($spaceKey)',
        popups_css : '$req.contextPath/styles/wysiwyg-action.css?spaceKey=$generalUtil.urlEncode($spaceKey)',
        button_tile_map : true,
        auto_reset_designmode : true,
        // show confimage link button only when we are in edit mode
        theme_advanced_buttons1 : "bold,italic,underline,strikethrough,formatselect,separator,table,delete_col,delete_row,col_after,col_before,row_after,row_before,separator,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,conflink,confimage,forecolor,hr,emotions,charmap,#if($action.isDevMode() == true)code,#end separator,fullscreen",
        theme_advanced_blockformats : "p,h1,h2,h3,h4,h5,h6,macro_quote,macro_noformat,macro_panel,macro_code",
        plugins : "table,paste,emotions,fullscreen,confluence",
        table_styles : "Table=confluenceTable",
        #if ($action.page && $action.page.id.toString() != '0')
        page_id : '$action.page.id',
        #else
        draft_type : '$parameters.draftType',
        #end
        form_name : '$parameters.formname',
        field_name : 'wysiwyg$parameters.id',
        context_path : '$req.contextPath',
        space_key : '$generalUtil.urlEncode(${parameters.spaceKey})'    ,
        cleanup : false,
        oninit : "tinyMCEOnInit",
        onchange_callback : "tinyMCEOnChangeHandler",
        visual : false,
        emotions_path : '$req.contextPath/images/icons/emoticons/',
        emotions_images : 'smile.gif,sad.gif,tongue.gif,biggrin.gif,wink.gif,thumbs_up.gif,thumbs_down.gif,information.gif,check.gif,error.gif,warning.gif,add.gif,forbidden.gif,help_16.gif,lightbulb_on.gif,lightbulb.gif,star_yellow.gif,star_red.gif,star_green.gif,star_blue.gif,star_yellow.gif',
        emotions_dialog_columns : 5,
        force_p_newlines: true,
        force_br_newlines: false,
        language: '$action.locale'
	-->
	
</ui:remove>					

</ui:composition>